<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>三级联动1</title>
</head>
<body>
    <label>省</label>
    <select id="pid" onchange="doPidChange();">
        <#list provinces as province>
            <option <#if pid == province.id > selected</#if> value="${province.id}">${province.name}</option>
        </#list>
    </select>
    <label>市</label>
    <select id="cid" onchange="doCidChange();">
        <#list citys as city>
            <option <#if cid == city.id > selected</#if>   value="${city.id}">${city.name}</option>
        </#list>
    </select>
    <label>区</label>
    <select>
        <#list districts as district>
        <option value="${district.id}">${district.name}</option>
    </#list>
    </select>

</body>
<script>
    function doPidChange(){
        pid = document.getElementById("pid").value;
        window.location.href = "/city/show?pid="+pid;
    }

    function doCidChange(){
        pid = document.getElementById("pid").value;
        cid = document.getElementById("cid").value;
        window.location.href = "/city/show?pid="+pid+"&cid="+cid;
    }

</script>
</html>